package com.ofwiki.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.time.LocalTime;

/**
 * created by chris on 2021/1/12.
 **/
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .description("#定时任务")
                        .version("1.0")
                        .build())
                .groupName("2.X版本")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.ofwiki.demo.web"))
                .paths(PathSelectors.any())
                .build()
                .directModelSubstitute(LocalTime.class,String.class);
        return docket;
    }
}
